package com.BigDate.server.service.impl;



import com.BigDate.server.mapper.ExpCommentMapper;
import com.BigDate.server.pojo.ExpComment;
import com.BigDate.server.pojo.expCommentNodeTreeVo;
import com.BigDate.server.service.IExpCommentService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author stx
 * @since 2021-12-22
 */
@Service
public class ExpCommentServiceImpl extends ServiceImpl<ExpCommentMapper, expCommentNodeTreeVo> implements IExpCommentService
{

    @Autowired
    private ExpCommentMapper expCommentMapper;

    @Override
    public List<expCommentNodeTreeVo> findComment(Integer expId) {
        return expCommentMapper.findComment(expId) ;
    }

    @Override
    public List<expCommentNodeTreeVo> findChildComment(Integer commentId) {
        return expCommentMapper.findChildComment(commentId);
    }

    @Override
    public int add(ExpComment comment) {
        return expCommentMapper.add(comment);
    }

    @Override
    public Page<expCommentNodeTreeVo> findAll(Integer current, Integer size) {
        Page<expCommentNodeTreeVo> page = new Page<>(current, size);
        Page<expCommentNodeTreeVo> expCommentNodeTreeVoPage = page.setRecords(expCommentMapper.findAll(page));
        return page;
    }

    @Override
    public int deleteById(Integer id) {
        return expCommentMapper.deleteById(id);
    }
}
